export function getBrowser() {
    var ua = window.navigator.userAgent;
    var isIE = window.ActiveXObject != undefined && ua.indexOf('MSIE') != -1;
    var isFirefox = ua.indexOf('Firefox') != -1;
    var isOpera = window.opr != undefined;
    var isChrome = ua.indexOf('Chrome') && window.chrome;
    var isSafari = (ua.indexOf('Safari') != -1 && ua.indexOf('Version') != -1) || ua.indexOf('iPhone') != -1;
    if (isIE) {
        return 'IE';
    } else if (isFirefox) {
        return 'Firefox';
    } else if (isOpera) {
        return 'Opera';
    } else if (isChrome) {
        return 'Chrome';
    } else if (isSafari) {
        return 'Safari';
    } else {
        return 'Unkown';
    }
}

export const isAndroidWeChat = () => {
    let isAndWechat = false,ua = window.userAgent;
    if ((ua.indexOf('android') > -1 || ua.indexOf('linux') > -1) && ua.match(/MicroMessenger/i) == 'micromessenger') {
        console.warn('当前浏览器为微信浏览器');
        isAndWechat = true;
    }
    return isAndWechat;
};
